Skip to content

dgb(phase-b): tail-hashrate-score chain-walk endpoints SSOT + KAT - #411

Merged
frstrtr merged 1 commit into
masterfrom
dgb/tail-score-endpoints
Jun 24, 2026
Merged

dgb(phase-b): tail-hashrate-score chain-walk endpoints SSOT + KAT#411
frstrtr merged 1 commit into
masterfrom
dgb/tail-score-endpoints

Conversation

@frstrtr

@frstrtr frstrtr commented Jun 24, 2026

Copy link
Copy Markdown
Owner

What

Phase-B SSOT slice: lift the pure integer endpoint arithmetic of ShareTracker::score() — the per-tail approximate-hashrate ranking that drives best_tail selection (data.py:767-772) — into a fenced header-only SSOT src/impl/dgb/coin/tail_score_endpoints.hpp.

Lifted (free functions over already-resolved inputs):

  • end-point offset CHAIN_LENGTH*15/16 (get_nth_parent_hash distance)
  • trailing walk length min(CHAIN_LENGTH/16, end_point_acc_height)
  • short-chain guard head_acc_height < CHAIN_LENGTH
  • unresolvable-block fallback (1e6 confirmations → tiny but non-zero score, matches p2pool work/(1e9·BLOCK_PERIOD))
  • time span max(1, block_span*BLOCK_PERIOD) and the work/time_span divide

The chain-walk halves (get_nth_parent_hash / get_chain / get_delta) stay in ShareTracker (they need the skip-list / TrackerView).

Oracle

p2pool-dgb-scrypt data.py:843-855 ShareTracker.score(). Every KAT expectation hand-derived from the oracle formula + DGB net constants (CHAIN_LENGTH 2880 mainnet / 400 testnet, PARENT.BLOCK_PERIOD 75s) — non-circular, incl. two full-composite hand-derived score anchors (resolved 4-deep → 3000; unresolvable → 10).

Fencing

No self-merge — integrator taps on full-rollup green.

Lift the pure integer endpoint arithmetic of ShareTracker::score() (the
per-tail approximate-hashrate ranking that drives best_tail selection)
into a fenced header-only SSOT, coin/tail_score_endpoints.hpp:

  - end-point offset   = CHAIN_LENGTH * 15 / 16   (get_nth_parent_hash dist)
  - trailing walk len  = min(CHAIN_LENGTH / 16, end_point_acc_height)
  - short-chain guard  = head_acc_height < CHAIN_LENGTH
  - unresolvable block = 1e6 confirmation fallback (tiny but non-zero score)
  - time span          = max(1, block_span * BLOCK_PERIOD)
  - score              = total_work / time_span

vs the p2pool-dgb-scrypt data.py:843-855 oracle. The chain-walk halves
(get_nth_parent_hash / get_chain / get_delta) stay in ShareTracker; this
slice lifts only the arithmetic, with a non-circular KAT (8/8) deriving
every expectation from the oracle formula + DGB net constants
(CHAIN_LENGTH 2880/400, BLOCK_PERIOD 75), including two full-composite
hand-derived score anchors.

FENCED, additive: share_tracker.hpp NOT rewired (byte-identity delegation
is the follow-on). Per-coin isolation: src/impl/dgb/ only. Test in both
build.yml --target arms + dir CMakeLists.txt.
@frstrtr
frstrtr merged commit 674a035 into master Jun 24, 2026
32 checks passed
frstrtr added a commit that referenced this pull request Jun 25, 2026
…ow-on)

Production byte-identical delegation of the six pure-arithmetic sites in
ShareTracker::score() onto the KAT-pinned coin/tail_score_endpoints.hpp
SSOT (landed header-only in #411). The chain walk stays inside the member
(it needs the verified skip-list / TrackerView); only the integer
endpoint/guard/span arithmetic is delegated:

  - short-chain guard      -> score_head_too_short
  - 15/16 endpoint offset  -> score_endpoint_offset
  - /16 tail walk count    -> score_tail_walk_count
  - unresolved-block span  -> score_resolved_block_span
  - span clamp             -> score_time_span
  - work/span divide       -> score_value

Value-identical (same int32_t span type, same uint288 divide); chain_length
is a positive net constant so signed/unsigned (CL*15)/16 and CL/16 coincide.
Diagnostic tail-ranking arithmetic, fenced to src/impl/dgb/, no consensus
value semantics changed. Closes the #411 SSOT drift-risk (header was not
yet referenced by the live score path).

dgb_share_test 34/34; dgb_tail_score_endpoints_test 8/8.
frstrtr added a commit that referenced this pull request Jun 25, 2026
dgb: rewire ShareTracker::score onto coin/ tail_score SSOT (#411 follow-on)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant